package gui.commands.classDiagramCommands;

import data.DataVector;
import data.classDiagram.ClassEntity;
import data.classDiagram.Entity;
import gui.commands.ICommand;

import java.util.List;

/**
 * User: Szymon Kudzia
 * Date: 10.05.13
 * Time: 12:06
 */
public class AddNewClassCommand implements ICommand {
	protected ClassEntity classEntity;

	protected String name;
	protected String baseClass;

	public AddNewClassCommand(String name, String baseClass) {
		this.name = name;
		this.baseClass = baseClass;
	}

	@Override
	public void execute() {
		classEntity = new ClassEntity();
		classEntity.setName(name);
		classEntity.setBaseClass(baseClass);

		DataVector.getInstance().addNewEntity(classEntity);
		DataVector.getInstance().refresh();
	}

	@Override
	public void undo() {
		DataVector.getInstance().removeEntity(classEntity);
		DataVector.getInstance().refresh();
	}

	@Override
	public void redo() {
		DataVector.getInstance().addEntity(classEntity);
		DataVector.getInstance().refresh();
	}
}
